package cn.akwangl.design.pattern.structural.facade;


import org.apache.ibatis.session.Configuration;
import org.springframework.jdbc.support.JdbcUtils;

/**
 * 外观模式#demo
 * <p>
 * 示例<br/>
 * {@link JdbcUtils}<br/>
 * {@link Configuration}<br/>
 * tomcat Class 后缀"facade"结尾<br/>
 *
 * </p>
 *
 * @author youyongkun
 * @date 2021/11/25 11:14
 * @since 1.0
 */
public class GiftExchangeService {
    private QualifyService qualifyService = new QualifyService();
    private PointsPaymentService pointsPaymentService = new PointsPaymentService();
    private ShippingService shippingService = new ShippingService();

    public void giftExchange(PointsGift pointsGift) {
        if (qualifyService.isAvailable(pointsGift)) {
            //资格校验通过
            if (pointsPaymentService.pay(pointsGift)) {
                //如果支付积分成功
                String shippingOrderNo = shippingService.shipGift(pointsGift);
                System.out.println("物流系统下单成功,订单号是:" + shippingOrderNo);
            }
        }
    }
}
